package com.quickask.operate.data;

/**
 * Created by Administrator on 2015/9/25.
 */
public class ResultCode {
    public static final int SUCCESS = 1; //成功
    public static final int FAILED = 0;
    public static final int UNKNOWN_ERROR = -1;//未知错误


    //SMS验证返回码
    public static final int SMS_200 = 200; //发送短信成功
    public static final int SMS_405 = 405; //AppKey为空
    public static final int SMS_406 = 406; //AppKey无效
    public static final int SMS_456 = 456; //国家代码或手机号码为空
    public static final int SMS_457 = 457; //手机号码格式错误
    public static final int SMS_466 = 466; //请求校验的验证码为空
    public static final int SMS_467 = 467; //请求校验验证码频繁（5分钟内同一个appkey的同一个号码最多只能校验三次）
    public static final int SMS_468 = 468; //验证码错误
    public static final int SMS_474 = 474; //没有打开服务端验证开关



    //用户错误码10XXX
    public static final int USER_TOKEN_ERROR = 10000;  //用户唯一token错误
    public static final int USERNICKNAME_ERROR = 10001;//用户不存在
    public static final int PASSWORD_ERROR = 10002;//密码错误
    public static final int USERTOKEN_ERROR = 10003;//用户token错误
    public static final int USERID_ERROR = 10004;//用户id不存在
    public static final int USERNAME_EXIST = 10005;//用户名已被使用
    public static final int USERPHONE_ERROR = 10006;//手机号码错误
    public static final int USERQQ_EXIST = 10007;//qq已被使用
    public static final int USERWECHAT_EXIST = 10008;//wechat已被使用
    public static final int USER_EXPIRE = 10009;//由于过长时间没登录等原因，token失效，请重新登录
    public static final int USERPHONE_REGISTERED = 10010;//手机号码已经被注册
    public static final int USERACCOUNT_REGISTERED = 10011;//账号已经被注册过
    public static final int QINIU_TOKEN_ERROR = 10012;//获取七牛token失败


    //问题错误码20XXX
    public static final int QUESTIONID_ERROR = 20001;//问题id不存在
    public static final int QUESTION_PAGER_END = 20002;//分页的最后一页
    public static final int QUESTION_LIST_EMPTY = 20003;//list为空
    public static final int QUESTION_ADOPT_ERROR = 20004;//设置最佳答案错误

    //答案错误码21XXXID
    public static final int ANSWER_ERROR = 21001;//答案id不存在
    public static final int VIDEOCATEGORY_ERROR = 21002;//视频分类id不存在

    //关注错误码3XXXX
    public static final int ATTEND_ERROR = 30001;//关注的用户id不存在，关注失败
    public static final int TOPICID_ERROR = 31001;//主题id不存在

    //收藏错误码40XXX
    public static final int COLLECTED_ERROR = 40001;//收藏失败

    //url错误码
    public static final int PARAMS_ERROR = 50001;  //参数错误

    //版本错误码90XXX
    public static final int VERSIONCODE_ERROR = 90001;//版本号有误
    public static final int TYPE_ERROR = 90002;//类型错误


    //根据resultcode返回错误信息
    public static String getErrmsg(Integer resultcode) {
        String errmsg = "";
        switch (resultcode) {
            case 0: errmsg = "失败"; break;
            case 1: errmsg = "成功"; break;
            case -1: errmsg = "未知错误"; break;
            case 200: errmsg="发送短信成功";break;
            case 405: errmsg="AppKey为空";break;
            case 406: errmsg="AppKey无效";break;
            case 456: errmsg="国家代码或手机号码为空";break;
            case 457: errmsg="手机号码格式错误";break;
            case 466: errmsg="请求校验的验证码为空";break;
            case 467: errmsg="请求校验验证码频繁";break;
            case 468: errmsg="验证码错误";break;
            case 474: errmsg="没有打开服务端验证开关";break;


            //用户类
            case 10000: errmsg = "token不存在";break;
            case 10001: errmsg = "用户不存在"; break;
            case 10002: errmsg = "密码错误"; break;
            case 10003: errmsg = "用户token错误"; break;
            case 10004: errmsg = "用户id不存在"; break;
            case 10005: errmsg = "用户名已被使用"; break;
            case 10006: errmsg = "手机号码错误"; break;
            case 10007: errmsg = "qq已被注册过"; break;
            case 10008: errmsg = "wechat已被注册过"; break;
            case 10009: errmsg = "由于过长时间没登录等原因，token失效，请重新登录"; break;
            case 10010: errmsg = "手机号码已经被注册"; break;
            case 10011: errmsg = "账号已经被注册过"; break;
            case 10012: errmsg ="获取权限失败";break;

            //问题类
            case 20001: errmsg = "问题id不存在"; break;
            case 20002: errmsg = "已是最后一页"; break;
            case 20003: errmsg = "结果集为空"; break;
            case 20004: errmsg = "采纳答案出错";break;

            //视频类
            case 21001: errmsg = "invalid video_id"; break;
            case 21002: errmsg = "invalid video_category"; break;

            //论坛类
            case 30001: errmsg = "invalid node_id"; break;
            case 31001: errmsg = "invalid topic_id"; break;

            //url错误
            case 50001: errmsg = "url参数错误";break;

            //版本类
            case 90001: errmsg = "版本号有误"; break;
            case 90002: errmsg = "类型错误";break;
        }
        return errmsg;
    }
}
